<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<meta charset="UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="css/edittable.css"></link>
<link rel="stylesheet" type="text/css" href="css/validate.css"></link>
<script type="text/javascript" src="js/jquery-1.8.0.js"></script>
<script type="text/javascript">
$(function(){
	$("input[type='radio']").each(function() {
		if($(this).val()=='${admin.roleId}'){
			$(this).attr("checked",true);
		}
		});
	$("#submit").click(function () {
		$.ajax({
			 url:"RoleServlet.do",
			 type:"POST",
			 data:{flag:"adminUpdate",id:'${admin.id}',ck_id:$("input[name='ck_id']:checked").val()},
			 success:function(data){
				 $("#result_msg").html(data);
			 } 
		 }); 
	});
	})
	
</script>
</head>
<body>
	<div class="div_title">
		<div class="div_titlename">
			<img src="images/san_jiao.gif"><span>用户角色修改</span>
		</div>
	</div>
	
		<table class="edit_table">
			<tr>
				<td class="td_info">用户名称:</td>
				<td class="td_input_short"><input type="text" class="txtbox"
					value="${admin.adminName }" id="adminName" name="adminName"
					disabled="disabled" /></td>
				<td><label class="validate_info" id="roleName_msg"></label></td>
			</tr>
			<tr>
				<td class="td_info">角色名称:</td>
				<td class="td_input_short">
				<c:forEach var="a" items="${role }" varStatus="st">
					<div><input type="radio" name="ck_id" value="${a.id}" /> ${a.roleName }<br></div>
				</c:forEach>
				</td>
				<td><label class="validate_info" id="roleName_msg"></label></td>
			</tr>
			<tr>
 			<td class="td_info"> </td>	
 			<td> 
 			<input class="form_btn" type="button" value="修改" id="submit"/> 
 			<input type="button" onclick="self.location=document.referrer;" class="form_btn" value="返回" /> </td>	
 			<td>
 				<label id="result_msg" class="result_msg"></label>
 			</td>	
 		</tr>
		</table>
</body>
</html>